// JSHumanizer, version 0.0
// Copyright © 2010, Richard Cook.
// http://jshumanizer.googlecode.com/
//
// This file is part of JSHumanizer.
 //
// JSHumanizer is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the licence or
// (at your option) any later version.
//
// JSHumanizer is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with JSHumanizer. If not, see <http://www.gnu.org/licenses/>.

var JSHumanizer = (function(self) {
  var days = {
    0: "dimanche",
    1: "lundi",
    2: "mardi",
    3: "mercredi",
    4: "jeudi",
    5: "vendredi",
    6: "samedi"
  };
  var months = {
    0: "janvier",
    1: "février",
    2: "mars",
    3: "avril",
    4: "mai",
    5: "juin",
    6: "juillet",
    7: "août",
    8: "septembre",
    9: "octobre",
    10: "novembre",
    11: "décembre"
  };

  self.getFullDateTimeString = function(date_time) {
    return self.getFullDateString(date_time) + " à " + self.getFullTimeString(date_time);
  };

  self.getFullDateString = function(date_time) {
    return days[date_time.getDay()] + " " +
      date_time.getDate() + " " +
      months[date_time.getMonth()] + " " +
      date_time.getFullYear();
  };

  self.getLongDateString = function(date_time) {
    return date_time.getDate() + " " +
      months[date_time.getMonth()] + " " +
      date_time.getFullYear();
  };

  self.getCommonDateString = function(date_time) {
    return self.__zeroPad(date_time.getDate(), 2) + "/" +
      self.__zeroPad(date_time.getMonth() + 1, 2) + "/" +
      date_time.getFullYear();
  };

  self.getShortDateString = function(date_time) {
    return self.__zeroPad(date_time.getDate(), 2) + "/" +
      self.__zeroPad(date_time.getMonth() + 1, 2) + "/" +
      self.__zeroPad(date_time.getFullYear() % 100, 2);
  };

  self.getFullTimeString = function(date_time) {
    return self.__zeroPad(date_time.getHours(), 2) + ":" + 
      self.__zeroPad(date_time.getMinutes(), 2) + ":" +
      self.__zeroPad(date_time.getSeconds(), 2);
  };

  self.humanizeInt = function(value) {
    return self.__humanizeIntHelper(value, 3, "&nbsp;");
  };

  self.humanizeDecimal = function(value, decimal_places) {
    return self.__humanizeDecimalHelper(value, decimal_places, ",", 3, "&nbsp;");
  };

  return self;
}(JSHumanizer || {}));

